import random
import json

def generate_cases():
    cases = []
    
    # 基础测试用例
    cases.append({"dataA": 0, "dataB": 0, "expected": 0})  # 双零
    cases.append({"dataA": 5, "dataB": 3, "expected": 8})  # 双正
    cases.append({"dataA": -5, "dataB": -3, "expected": -8})  # 双负
    cases.append({"dataA": 5, "dataB": -3, "expected": 2})  # 正负
    
    # 边界值测试
    cases.append({"dataA": 2147483647, "dataB": 1, "expected": -2147483648})  # 正溢出
    cases.append({"dataA": -2147483648, "dataB": -1, "expected": 2147483647})  # 负溢出
    cases.append({"dataA": 2147483647, "dataB": -1, "expected": 2147483646})
    
    # 随机测试用例（多种组合）
    for _ in range(20):
        a = random.randint(-1000, 1000)
        b = random.randint(-1000, 1000)
        cases.append({
            "dataA": a,
            "dataB": b,
            "expected": a + b
        })
    
    # 大数据测试
    cases.append({
        "dataA": 123456789, 
        "dataB": -987654321, 
        "expected": -864197532
    })
    
    return cases

def save_cases(cases, filename="test_cases.json"):
    with open(filename, "w") as f:
        json.dump(cases, f, indent=2)

if __name__ == "__main__":
    test_cases = generate_cases()
    save_cases(test_cases)
    print(f"Generated {len(test_cases)} test cases")